"""
PyQt5版GUI工具
"""
from PyQt5.QtWidgets import * # type: ignore
from PyQt5.QtCore import * # type: ignore
from PyQt5.QtGui import * # type: ignore
from ui.Ui_my_mainwindow import Ui_MainWindow
from ui.Ui_my_dialog import Ui_Dialog
import sys

class MyDialog(QDialog): 

    def __init__(self):
        super().__init__()
        # 创建对象
        self.ui = Ui_Dialog()
        # 初始化内容
        self.ui.setupUi(self)
        # 初始化ui
        self.init_ui()
    

    def init_ui(self):
        pass
        


class MianWindow(QMainWindow): 

    def __init__(self):
        super().__init__()
        # 创建对象
        self.ui = Ui_MainWindow()
        # 初始化内容
        self.ui.setupUi(self)
        # 初始化ui
        self.init_ui()
    
    def on_btn_clicked(self):
        self.ui.label.setText("再见杰克")
        self.statusBar().showMessage("goodbye jeck")
        
        dialog = MyDialog()
        rst = dialog.exec_()
        
        print("rst:",rst)

    def init_ui(self):
        self.ui.pushButton.clicked.connect(self.on_btn_clicked)
        

def main():
    app = QApplication(sys.argv)
    window = MianWindow()
    window.show()
    sys.exit(app.exec_())


if __name__ == '__main__':
    main()